<include file="Public:header" />
<div class="container"> <include file="Public:leftMenu" />
  <div class="mainbody">
  <include file="Public:activityMenu" />
    <div class="rig_lm03">
      <div class="title" ><img src="{$Think.config.static_path}images/listicon.jpg" class="icon" >
        <h2>创建/编辑活动</h2>        
      </div>
      <div class="detail-tab">
          <form name="form1"  enctype="multipart/form-data" method="post" action="__URL__/saveAddAvtivity" role="form" >
          <div class="form-group">
            <label for="title">活动标题<i>*</i></label>
            <input type="text" name="title" class="searcheTxt"  id="title" placeholder="" value="{$data.title}">
          </div>
		 <div class="form-group">
            <label for="p_stint">隔天投票</label>
            <input type="checkbox" value="1"  name="getian" <if condition="$data.getian eq 1">checked="checked"</if>>
            <p class="help-block formRemind" style="margin-left:150px; margin-top:-15px;" >第二天可以继续参与投票活动。</p>
          </div>
           <div class="form-group">
            <label for="p_stint">重复投票</label>
            <input type="checkbox" value="1"  name="repeat" <if condition="$data.repeat eq 1">checked="checked"</if>>
            <p class="help-block formRemind" style="margin-left:150px; margin-top:-15px;" >针对个人可以多次投票。</p>
          </div>
          <div class="form-group">
            <label for="startDate">开始时间<i>*</i></label>
            <input type="text" name="start_time" class="searcheTxt" id="start_time" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" placeholder="" value='{$data.start_time|date="Y-m-d H:i:s",###}'>
          </div>
          <div class="form-group">
            <label for="endDate">结束时间<i>*</i></label>
            <input type="text" name="end_time" class="searcheTxt" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" id="end_time" placeholder="" value='{$data.end_time|date="Y-m-d H:i:s",###}'>
          </div>
          
          <div class="form-group">
            <label for="p_stint">投票次数<i>*</i></label>
            <input type="text" name="p_stint" class="searcheTxt" id="p_stint" value='{$data.p_stint}' onkeyup="value=value.replace(/[^\d]/g,'') " onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))">
            <p class="help-block formRemind">可参与投票次数。</p>
          </div>
          
         <!-- <div class="form-group">
            <label for="t_stint">集体可选<i>*</i></label>
            <input type="text" name="t_stint" class="searcheTxt" id="t_stint" placeholder="" value='{$data.t_stint}' onkeyup="value=value.replace(/[^\d]/g,'') " onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))">
            <p class="help-block formRemind">可同时投票集体数。</p>
          </div>
          -->
           <div class="form-group">
            <label for="exampleInputEmail1">图片</label>
            <notempty name="data.imgurl"><img class="table_imgAdd" src="{$Think.config.IMG_PATH}{$data.imgurl}"></notempty>
            <div class="qq-upload-button"><span id='up_txt'>选择文件</span>
              <input name="imgUrl" id="imgUrl" class="transparent_class"  type="file" onchange="javascript:$('#up_txt').html($('input[type=file]').attr('value'));" />
            </div>
          </div>
         <!-- <div class="form-group">
            <label for="endDate">活动规则<i>*</i></label>
            <textarea name="rules" id="rules"   class="inputTextarea">{$data.rules|strip_tags}</textarea>
          </div>-->
          
          <div class="form-group ">
            <label for="IbtnEnter"></label>
            <button type="button"  id="IbtnEnter" class="btn btn-primary "><span class="glyphicon glyphicon-floppy-saved"></span> 保 存 </button>
          </div>
          <input type="hidden" name="id" value="{$data.id}">
          </form>
      </div>
    </div>
  </div>
</div>



<include file="Public:footer" /> 
<script type="text/javascript">

$(function(){
	$('#sAdd').addClass('rig_seleli');
	$("#IbtnEnter").click(function(){
		   saveActivity();
	 });
});

function saveActivity() {
    var state = true;
    if ($("#title").attr("value") == "") {
        alert("请输入活动标题！");
        state = false;
        $("#title").focus();
        return false
    }
	if ($("#start_time").attr("value") == "") {
        alert("请输入开始时间！");
        state = false;
        $("#start_time").focus();
        return false
    }
	if ($("#end_time").attr("value") == "") {
        alert("请输入结束时间！");
        state = false;
        $("#end_time").focus();
        return false
    }
    
    if (state) {
       $("form").submit();
		//commonAjaxSubmit("__URL__/saveAddAvtivity","{$_REQUEST['id']}");
    }
};
</script>